Skip to content

Conversation

@tangrufus
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings October 26, 2025 19:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces PHPStan static analysis tooling at maximum strictness level to improve type safety and code quality. The changes focus on replacing loose type coercion with explicit type checking and validation throughout the codebase.

  • Added PHPStan configuration with strict rules and deprecation checking
  • Refactored the Feed enum to use backed enum values, eliminating the need for separate label() and url() methods
  • Enhanced type safety across factory classes with explicit type validation and PHPDoc annotations

Reviewed Changes

Copilot reviewed 14 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
phpstan.neon New PHPStan configuration file enabling maximum strictness level
composer.json Added PHPStan packages and configured lint script with static analysis
.github/workflows/lint.yml Enabled PHPStan checking in CI pipeline
src/Feed.php Converted to backed enum using URL strings as values
src/Client.php Updated to use backed enum value and added type guard for array elements
src/Exceptions/InvalidJsonException.php Changed from label() method to name property
src/Exceptions/HttpException.php Changed from label() method to name property
tests/Feature/TestCase.php Updated fixture path to use name property instead of label() method
src/RecordFactory.php Added PHPDoc annotations and replaced loose type coercion with explicit validation
src/SoftwareFactory.php Added PHPDoc annotations and explicit type checking for all inputs
src/CvssFactory.php Enhanced type validation with support for numeric score conversion
src/CopyrightFactory.php Replaced loose type coercion with explicit string type checks
src/AffectedVersionsParser.php Removed unused constant and improved constraint filtering logic
src/Record.php Added missing PHPDoc annotation for references parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
try {
return $this->http->get($feed->url());
return $this->http->request('GET', $feed->value);
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The HTTP method is now explicitly specified as 'GET' instead of using the dedicated get() method. While functionally equivalent, using $this->http->get($feed->value) would be more idiomatic and clearer in intent. The get() method is the standard Guzzle approach for GET requests.

Suggested change
return $this->http->request('GET', $feed->value);
return $this->http->get($feed->value);

Copilot uses AI. Check for mistakes.
@tangrufus tangrufus changed the title Lint with PHPStan Remove Feed::label() and Feed::url() Oct 26, 2025
@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.50%. Comparing base (24fb8ca) to head (e22877a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/Exceptions/HttpException.php 0.00% 1 Missing ⚠️
src/Exceptions/InvalidJsonException.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #30      +/-   ##
============================================
- Coverage     89.15%   88.50%   -0.66%     
+ Complexity       83       77       -6     
============================================
  Files            13       12       -1     
  Lines           212      200      -12     
============================================
- Hits            189      177      -12     
  Misses           23       23              
Flag Coverage Δ
e2e 82.00% <33.33%> (+1.33%) ⬆️
feature 82.00% <33.33%> (-1.02%) ⬇️
unit 84.00% <33.33%> (+3.81%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tangrufus tangrufus requested a review from Copilot October 26, 2025 19:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tangrufus tangrufus merged commit a264cd5 into main Oct 26, 2025
17 checks passed
@tangrufus tangrufus deleted the enum branch October 26, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants